/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package modeltotree.impl;

import BoardGame.BoardGamePackage;

import MocaTree.MocaTreePackage;

import Rules.RulesPackage;

import modeltotree.ModeltotreeFactory;
import modeltotree.ModeltotreePackage;
import modeltotree.TransformModelToTree;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class ModeltotreePackageImpl extends EPackageImpl implements
		ModeltotreePackage {
	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private EClass transformModelToTreeEClass = null;

	/**
	 * Creates an instance of the model <b>Package</b>, registered with
	 * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
	 * package URI value.
	 * <p>Note: the correct way to create the package is via the static
	 * factory method {@link #init init()}, which also performs
	 * initialization of the package, or returns the registered package,
	 * if one already exists.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see org.eclipse.emf.ecore.EPackage.Registry
	 * @see modeltotree.ModeltotreePackage#eNS_URI
	 * @see #init()
	 * @generated
	 */
	private ModeltotreePackageImpl() {
		super(eNS_URI, ModeltotreeFactory.eINSTANCE);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private static boolean isInited = false;

	/**
	 * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
	 * 
	 * <p>This method is used to initialize {@link ModeltotreePackage#eINSTANCE} when that field is accessed.
	 * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #eNS_URI
	 * @see #createPackageContents()
	 * @see #initializePackageContents()
	 * @generated
	 */
	public static ModeltotreePackage init() {
		if (isInited)
			return (ModeltotreePackage) EPackage.Registry.INSTANCE
					.getEPackage(ModeltotreePackage.eNS_URI);

		// Obtain or create and register package
		ModeltotreePackageImpl theModeltotreePackage = (ModeltotreePackageImpl) (EPackage.Registry.INSTANCE
				.get(eNS_URI) instanceof ModeltotreePackageImpl ? EPackage.Registry.INSTANCE
				.get(eNS_URI) : new ModeltotreePackageImpl());

		isInited = true;

		// Initialize simple dependencies
		RulesPackage.eINSTANCE.eClass();

		// Create package meta-data objects
		theModeltotreePackage.createPackageContents();

		// Initialize created meta-data
		theModeltotreePackage.initializePackageContents();

		// Mark meta-data to indicate it can't be changed
		theModeltotreePackage.freeze();

		// Update the registry and return the package
		EPackage.Registry.INSTANCE.put(ModeltotreePackage.eNS_URI,
				theModeltotreePackage);
		return theModeltotreePackage;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EClass getTransformModelToTree() {
		return transformModelToTreeEClass;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EOperation getTransformModelToTree__Transform__Board() {
		return transformModelToTreeEClass.getEOperations().get(0);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ModeltotreeFactory getModeltotreeFactory() {
		return (ModeltotreeFactory) getEFactoryInstance();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isCreated = false;

	/**
	 * Creates the meta-model objects for the package.  This method is
	 * guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void createPackageContents() {
		if (isCreated)
			return;
		isCreated = true;

		// Create classes and their features
		transformModelToTreeEClass = createEClass(TRANSFORM_MODEL_TO_TREE);
		createEOperation(transformModelToTreeEClass,
				TRANSFORM_MODEL_TO_TREE___TRANSFORM__BOARD);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	private boolean isInitialized = false;

	/**
	 * Complete the initialization of the package and its meta-model.  This
	 * method is guarded to have no affect on any invocation but its first.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void initializePackageContents() {
		if (isInitialized)
			return;
		isInitialized = true;

		// Initialize package
		setName(eNAME);
		setNsPrefix(eNS_PREFIX);
		setNsURI(eNS_URI);

		// Obtain other dependent packages
		MocaTreePackage theMocaTreePackage = (MocaTreePackage) EPackage.Registry.INSTANCE
				.getEPackage(MocaTreePackage.eNS_URI);
		BoardGamePackage theBoardGamePackage = (BoardGamePackage) EPackage.Registry.INSTANCE
				.getEPackage(BoardGamePackage.eNS_URI);

		// Create type parameters

		// Set bounds for type parameters

		// Add supertypes to classes

		// Initialize classes, features, and operations; add parameters
		initEClass(transformModelToTreeEClass, TransformModelToTree.class,
				"TransformModelToTree", !IS_ABSTRACT, !IS_INTERFACE,
				IS_GENERATED_INSTANCE_CLASS);

		EOperation op = initEOperation(
				getTransformModelToTree__Transform__Board(),
				theMocaTreePackage.getFile(), "transform", 0, 1, IS_UNIQUE,
				IS_ORDERED);
		addEParameter(op, theBoardGamePackage.getBoard(), "board", 0, 1,
				IS_UNIQUE, IS_ORDERED);

		// Create resource
		createResource(eNS_URI);

		// Create annotations
		// SDM
		createSDMAnnotations();
	}

	/**
	 * Initializes the annotations for <b>SDM</b>.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void createSDMAnnotations() {
		String source = "SDM";
		addAnnotation(
				getTransformModelToTree__Transform__Board(),
				source,
				new String[] {
						"XMI",
						"<?xml version=\"1.0\" encoding=\"ASCII\"?>\r\n<SDMLanguage.activities:Activity xmlns:xmi=\"http://www.omg.org/XMI\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ecore=\"http://www.eclipse.org/emf/2002/Ecore\" xmlns:SDMLanguage.activities=\"http://www.moflon.org/SDMLanguage.activities\" xmlns:SDMLanguage.expressions=\"http://www.moflon.org/SDMLanguage.expressions\" xmlns:SDMLanguage.patterns=\"http://www.moflon.org/SDMLanguage.patterns\" xmlns:SDMLanguage.patterns.patternExpressions=\"http://www.moflon.org/SDMLanguage.patterns.patternExpressions\" xmlns:SDMLanguage.calls.callExpressions=\"http://www.moflon.org/SDMLanguage.calls.callExpressions\" xmlns:SDMLanguage.calls=\"http://www.moflon.org/SDMLanguage.calls\" xsi:schemaLocation=\"http://www.moflon.org/SDMLanguage.activities SDMLanguage.ecore#//activities http://www.moflon.org/SDMLanguage.patterns SDMLanguage.ecore#//patterns\" owningOperation=\"http://www.moflon.org/modeltotree#//TransformModelToTree/transform\">\r\n  <ownedActivityNode xsi:type=\"SDMLanguage.activities:StartNode\" outgoing=\"#//@ownedActivityEdge.0 \" name=\"TransformModelToTree::transform (board: Board): File\" />\r\n  <ownedActivityEdge guard=\"NONE\" target=\"#//@ownedActivityNode.3\" source=\"#//@ownedActivityNode.0\" />\r\n  <ownedActivityNode xsi:type=\"SDMLanguage.activities:StoryNode\" forEach=\"true\" outgoing=\"#//@ownedActivityEdge.1 #//@ownedActivityEdge.2 \" incoming=\"#//@ownedActivityEdge.4 #//@ownedActivityEdge.5 \" name=\"ActivityNode1\">\r\n    <storyPattern>\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" bindingState=\"BOUND\" outgoingLink=\"#//@ownedActivityNode.1/@storyPattern/@linkVariable.0 \" name=\"board\" type=\"ecore:EClass http://www.moflon.org/BoardGame#//Board\" />\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" bindingState=\"UNBOUND\" incomingLink=\"#//@ownedActivityNode.1/@storyPattern/@linkVariable.0 \" name=\"curField\" type=\"ecore:EClass http://www.moflon.org/BoardGame#//Field\" />\r\n      <linkVariable xsi:type=\"SDMLanguage.patterns:LinkVariable\" bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" target=\"#//@ownedActivityNode.1/@storyPattern/@objectVariable.1\" source=\"#//@ownedActivityNode.1/@storyPattern/@objectVariable.0\" name=\"fields\" />\r\n    </storyPattern>\r\n  </ownedActivityNode>\r\n  <ownedActivityEdge guard=\"EACH_TIME\" target=\"#//@ownedActivityNode.2\" source=\"#//@ownedActivityNode.1\" />\r\n  <ownedActivityEdge guard=\"END\" target=\"#//@ownedActivityNode.4\" source=\"#//@ownedActivityNode.1\" />\r\n  <ownedActivityNode xsi:type=\"SDMLanguage.activities:StoryNode\" forEach=\"false\" outgoing=\"#//@ownedActivityEdge.3 \" incoming=\"#//@ownedActivityEdge.1 \" name=\"ActivityNode2\">\r\n    <storyPattern>\r\n      <objectVariable bindingSemantics=\"OPTIONAL\" bindingOperator=\"CREATE\" bindingState=\"UNBOUND\" outgoingLink=\"#//@ownedActivityNode.2/@storyPattern/@linkVariable.1 \" incomingLink=\"#//@ownedActivityNode.2/@storyPattern/@linkVariable.0 \" name=\"row\" type=\"ecore:EClass http://www.moflon.org/MocaTree#//Node\">\r\n        <constraint>\r\n          <constraintExpression xsi:type=\"SDMLanguage.expressions:ComparisonExpression\" operator=\"EQUAL\">\r\n            <leftExpression xsi:type=\"SDMLanguage.patterns.patternExpressions:AttributeValueExpression\" attribute=\"http://www.moflon.org/MocaTree#//TreeElement/index\" object=\"#//@ownedActivityNode.2/@storyPattern/@objectVariable.0\" />\r\n            <rightExpression xsi:type=\"SDMLanguage.patterns.patternExpressions:AttributeValueExpression\" attribute=\"http://www.moflon.org/BoardGame#//Field/y\" object=\"#//@ownedActivityNode.5/@storyPattern/@objectVariable.0\" />\r\n          </constraintExpression>\r\n        </constraint>\r\n        <attributeAssignment attribute=\"http://www.moflon.org/MocaTree#//TreeElement/index\">\r\n          <valueExpression xsi:type=\"SDMLanguage.patterns.patternExpressions:AttributeValueExpression\" attribute=\"http://www.moflon.org/BoardGame#//Field/y\" object=\"#//@ownedActivityNode.5/@storyPattern/@objectVariable.0\" />\r\n        </attributeAssignment>\r\n        <attributeAssignment attribute=\"http://www.moflon.org/MocaTree#//TreeElement/name\">\r\n          <valueExpression xsi:type=\"SDMLanguage.expressions:LiteralExpression\" type=\"\" value=\"&quot;Row&quot;\" />\r\n        </attributeAssignment>\r\n      </objectVariable>\r\n      <linkVariable xsi:type=\"SDMLanguage.patterns:LinkVariable\" bindingSemantics=\"OPTIONAL\" bindingOperator=\"CREATE\" target=\"#//@ownedActivityNode.2/@storyPattern/@objectVariable.0\" source=\"#//@ownedActivityNode.2/@storyPattern/@objectVariable.1\" name=\"children\" />\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" bindingState=\"BOUND\" outgoingLink=\"#//@ownedActivityNode.2/@storyPattern/@linkVariable.0 \" name=\"boardNode\" type=\"ecore:EClass http://www.moflon.org/MocaTree#//Node\" />\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CREATE\" bindingState=\"UNBOUND\" incomingLink=\"#//@ownedActivityNode.2/@storyPattern/@linkVariable.1 \" name=\"fieldNode\" type=\"ecore:EClass http://www.moflon.org/MocaTree#//Node\">\r\n        <attributeAssignment attribute=\"http://www.moflon.org/MocaTree#//TreeElement/name\">\r\n          <valueExpression xsi:type=\"SDMLanguage.expressions:LiteralExpression\" type=\"\" value=\"&quot;Field&quot;\" />\r\n        </attributeAssignment>\r\n      </objectVariable>\r\n      <linkVariable xsi:type=\"SDMLanguage.patterns:LinkVariable\" bindingSemantics=\"MANDATORY\" bindingOperator=\"CREATE\" target=\"#//@ownedActivityNode.2/@storyPattern/@objectVariable.2\" source=\"#//@ownedActivityNode.2/@storyPattern/@objectVariable.0\" name=\"children\" />\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" bindingState=\"BOUND\" name=\"curField\" type=\"ecore:EClass http://www.moflon.org/BoardGame#//Field\" />\r\n    </storyPattern>\r\n  </ownedActivityNode>\r\n  <ownedActivityEdge guard=\"NONE\" target=\"#//@ownedActivityNode.5\" source=\"#//@ownedActivityNode.2\" />\r\n  <ownedActivityNode xsi:type=\"SDMLanguage.activities:StoryNode\" forEach=\"false\" outgoing=\"#//@ownedActivityEdge.4 \" incoming=\"#//@ownedActivityEdge.0 \" name=\"ActivityNode3\">\r\n    <storyPattern>\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CREATE\" bindingState=\"UNBOUND\" outgoingLink=\"#//@ownedActivityNode.3/@storyPattern/@linkVariable.0 \" name=\"file\" type=\"ecore:EClass http://www.moflon.org/MocaTree#//File\">\r\n        <attributeAssignment attribute=\"http://www.moflon.org/MocaTree#//TreeElement/name\">\r\n          <valueExpression xsi:type=\"SDMLanguage.expressions:LiteralExpression\" type=\"\" value=\"&quot;board.txt&quot;\" />\r\n        </attributeAssignment>\r\n      </objectVariable>\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CREATE\" bindingState=\"UNBOUND\" incomingLink=\"#//@ownedActivityNode.3/@storyPattern/@linkVariable.0 \" name=\"boardNode\" type=\"ecore:EClass http://www.moflon.org/MocaTree#//Node\">\r\n        <attributeAssignment attribute=\"http://www.moflon.org/MocaTree#//TreeElement/name\">\r\n          <valueExpression xsi:type=\"SDMLanguage.expressions:LiteralExpression\" type=\"\" value=\"&quot;Board&quot;\" />\r\n        </attributeAssignment>\r\n      </objectVariable>\r\n      <linkVariable xsi:type=\"SDMLanguage.patterns:LinkVariable\" bindingSemantics=\"MANDATORY\" bindingOperator=\"CREATE\" target=\"#//@ownedActivityNode.3/@storyPattern/@objectVariable.1\" source=\"#//@ownedActivityNode.3/@storyPattern/@objectVariable.0\" name=\"rootNode\" />\r\n    </storyPattern>\r\n  </ownedActivityNode>\r\n  <ownedActivityEdge guard=\"NONE\" target=\"#//@ownedActivityNode.1\" source=\"#//@ownedActivityNode.3\" />\r\n  <ownedActivityNode xsi:type=\"SDMLanguage.activities:StopNode\" incoming=\"#//@ownedActivityEdge.2 \" name=\"file\">\r\n    <returnValue xsi:type=\"SDMLanguage.patterns.patternExpressions:ObjectVariableExpression\" object=\"#//@ownedActivityNode.3/@storyPattern/@objectVariable.0\" />\r\n  </ownedActivityNode>\r\n  <ownedActivityNode xsi:type=\"SDMLanguage.activities:StoryNode\" forEach=\"false\" outgoing=\"#//@ownedActivityEdge.5 \" incoming=\"#//@ownedActivityEdge.3 \" name=\"ActivityNode4\">\r\n    <storyPattern>\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" bindingState=\"BOUND\" outgoingLink=\"#//@ownedActivityNode.5/@storyPattern/@linkVariable.0 \" name=\"curField\" type=\"ecore:EClass http://www.moflon.org/BoardGame#//Field\" />\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" bindingState=\"UNBOUND\" incomingLink=\"#//@ownedActivityNode.5/@storyPattern/@linkVariable.0 \" name=\"curFigure\" type=\"ecore:EClass http://www.moflon.org/BoardGame#//Figure\" />\r\n      <linkVariable xsi:type=\"SDMLanguage.patterns:LinkVariable\" bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" target=\"#//@ownedActivityNode.5/@storyPattern/@objectVariable.1\" source=\"#//@ownedActivityNode.5/@storyPattern/@objectVariable.0\" name=\"figure\" />\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CHECK_ONLY\" bindingState=\"BOUND\" incomingLink=\"#//@ownedActivityNode.5/@storyPattern/@linkVariable.1 \" name=\"fieldNode\" type=\"ecore:EClass http://www.moflon.org/MocaTree#//Node\" />\r\n      <linkVariable xsi:type=\"SDMLanguage.patterns:LinkVariable\" bindingSemantics=\"MANDATORY\" bindingOperator=\"CREATE\" target=\"#//@ownedActivityNode.5/@storyPattern/@objectVariable.2\" source=\"#//@ownedActivityNode.5/@storyPattern/@objectVariable.3\" name=\"parentNode\" />\r\n      <objectVariable bindingSemantics=\"MANDATORY\" bindingOperator=\"CREATE\" bindingState=\"UNBOUND\" outgoingLink=\"#//@ownedActivityNode.5/@storyPattern/@linkVariable.1 \" name=\"figureNode\" type=\"ecore:EClass http://www.moflon.org/MocaTree#//Node\">\r\n        <attributeAssignment attribute=\"http://www.moflon.org/MocaTree#//TreeElement/name\">\r\n          <valueExpression xsi:type=\"SDMLanguage.expressions:LiteralExpression\" type=\"\" value=\"curFigure.eClass().getName().substring(0, 1)\" />\r\n        </attributeAssignment>\r\n      </objectVariable>\r\n    </storyPattern>\r\n  </ownedActivityNode>\r\n  <ownedActivityEdge guard=\"NONE\" target=\"#//@ownedActivityNode.1\" source=\"#//@ownedActivityNode.5\" />\r\n</SDMLanguage.activities:Activity>" });
	}

} //ModeltotreePackageImpl
